<template>
    <div class='s_body'>
        <div class='s_menu'>
            <div class='s_menu_item'>
                新增模块
            </div>
        </div>
        <div class='s_content'>
            <div v-if="newModel" class="newModel">
                <el-row class='s_new_model'>
                    <el-col :span="8">
                        <el-input v-model="modelName" placeholder="请输入模块名称" id='modelName' name='modelName'></el-input>
                    </el-col>
                    
                    <el-col :span="4">
                         <el-button type="success" v-on:click="searchModel">查询</el-button>
                         <el-button type="warning">确定生成</el-button>
                    </el-col>
                   
                </el-row>
                <el-row v-if='isSearchModel||isCreateModel' flag='model'>
                    <el-col :span="12" v-if='isSearchModel'>
                        <template>
                            <el-table
                                :data="modelData"
                                height="330"
                                ref="singleTable"
                                 highlight-current-row
                                style="width: 100%"
                                @current-change="handleCurrentChange"
                                >
                               
                                <el-table-column
                                prop="wur_type"
                                label="wur_type"
                                width="100">
                                </el-table-column>
                                <el-table-column
                                prop="wur_name"
                                label="wur_name"
                                width="100">
                                </el-table-column>
                                <el-table-column
                                prop="wur_baseurl"
                                label="wur_baseurl">
                                </el-table-column>
                                 <el-table-column
                                prop="wur_title"
                                label="wur_title">
                                </el-table-column>
                                 <el-table-column
                                prop="wur_field"
                                label="wur_field">
                                </el-table-column>
                                 <el-table-column
                                prop="wur_filename"
                                label="wur_filename">
                                </el-table-column>
                                 <el-table-column
                                prop="wur_post"
                                label="wur_post">
                                </el-table-column>
                                 <el-table-column
                                prop="wur_listname"
                                label="wur_listname">
                                </el-table-column>
                                 <el-table-column
                                prop="wur_jsurl"
                                label="wur_jsurl">
                                </el-table-column>
                                 <el-table-column
                                prop="wur_per"
                                label="wur_per">
                                </el-table-column>
                            </el-table>
                            </template>

                    </el-col>
                    
                      <el-col :span="12" v-if='isCreateModel'>
                          <el-form :inline="true" :model="formInline" class="demo-form-inline" label-width="90px">
                            <el-form-item label="wur_type">
                                <el-input v-model="currentRow.wur_type" placeholder="wur_type"></el-input>
                            </el-form-item>
                            <el-form-item label="wur_name">
                                <el-input v-model="currentRow.wur_name" placeholder="wur_name"></el-input>
                            </el-form-item>
                             <el-form-item label="wur_baseurl">
                                <el-input v-model="currentRow.wur_baseurl" placeholder="wur_baseurl"></el-input>
                            </el-form-item>
                             <el-form-item label="wur_title">
                                <el-input v-model="currentRow.wur_title" placeholder="wur_title"></el-input>
                            </el-form-item>
                             <el-form-item label="wur_field">
                                <el-input v-model="currentRow.wur_field" placeholder="wur_field"></el-input>
                            </el-form-item>
                             <el-form-item label="wur_filename">
                                <el-input v-model="currentRow.wur_filename" placeholder="wur_filename"></el-input>
                            </el-form-item>
                             <el-form-item label="wur_post">
                                <el-input v-model="currentRow.wur_post" placeholder="wur_post"></el-input>
                            </el-form-item>
                             <el-form-item label="wur_listname">
                                <el-input v-model="currentRow.wur_listname" placeholder="wur_listname"></el-input>
                            </el-form-item>
                            <el-form-item label="wur_jsurl">
                                <el-input v-model="currentRow.wur_jsurl" placeholder="wur_jsurl"></el-input>
                            </el-form-item>
                             <el-form-item label="wur_per">
                                <el-input v-model="currentRow.wur_per" placeholder="wur_per"></el-input>
                                <input type=hidden v-model="currentRow.wur_id"/>
                            </el-form-item>
                          </el-form>
                      </el-col>
                </el-row>
            </div>
        </div>
    </div>
</template>
<script>
 export default {
    data(){
        return {
            newModel:true,
            isSearchModel:false,//是否查询模块
            isCreateModel:false,//是否已生成模块
            modelData:[],
            modelName:'',
            currentRow:null
        }
    }, 
    beforeCreate(){
      document.title="深蓝系统命令控制台"; 
    },
    methods:{
        handleCurrentChange(val) {
            this.currentRow = val;
            this.isCreateModel=true;
            
        },
        searchModel(){
            this.isSearchModel=true;
            this.$post('apiServe/searchModel',{
                name:escape(document.getElementById("modelName").value)
            }).then(data=>{
                this.modelData=data;
            });
        }
    }
}
</script>

<style scoped  src="../assets/css/summary.css">
</style>